//
//  TPLabel.m
//  CloudAtCostPanel
//
//  Created by leonardo on 2017/2/9.
//  Copyright © 2017年 tanpengsccd. All rights reserved.
//

#import "TPLabel.h"
#import "TPUIMacro.h"
#import "TPView.h"
@implementation TPLabel

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.textAlignment = NSTextAlignmentLeft;
        self.textColor = COLOUR_CONTENT;
        self.numberOfLines = 0;
        self.font = FONTSIZE_CONTENT;
        self.lineBreakMode = NSLineBreakByTruncatingTail;
    }
    return self;
}

+(instancetype)labelWithText:(NSString *)text Font:(UIFont *)font{
    return [[TPLabel alloc]initWithText:text Font:font];
}

-(instancetype)initWithText:(NSString *)text Font:(UIFont *)font{
    return [self initWithText:text font:font textColor:COLOUR_TITILE textAlignment:NSTextAlignmentLeft bgColor:COLOUR_TRANSLUCENT numberOfLines:0 lineBreakMode:NSLineBreakByTruncatingTail];
}

+(instancetype)labelWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor textAlignment:(NSTextAlignment)textAlignment bgColor:(UIColor *)bgColor numberOfLines:(NSUInteger)numberOfLines lineBreakMode:(NSLineBreakMode)lineBreakMode{
    TPLabel * label = [[TPLabel alloc]initWithText:text font:font textColor:textColor textAlignment:textAlignment bgColor:bgColor numberOfLines:numberOfLines lineBreakMode:lineBreakMode];
    return label;
}

-(instancetype)initWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor textAlignment:(NSTextAlignment)textAlignment bgColor:(UIColor *)bgColor numberOfLines:(NSUInteger)numberOfLines lineBreakMode:(NSLineBreakMode)lineBreakMode{
    if (!text) {
        return [TPLabel new];
    }else{
        self = [self init];
        if (self) {
            self.text = text;
            self.backgroundColor = bgColor;
            self.textAlignment = textAlignment;
            self.textColor = textColor;
            self.numberOfLines = numberOfLines;
            self.font = font;
            self.lineBreakMode = lineBreakMode;
            
        }
        return self;
    }
    
    
    
}
@end
